package cn.junior_programmer.springsecurityjdbc.manager;

import cn.junior_programmer.springsecurityjdbc.entity.User;
import cn.junior_programmer.springsecurityjdbc.mapper.UserMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * @author junior_programmer
 */
@Service
public class UserManager extends ServiceImpl<UserMapper, User> {


    public User loadByUserName(String userName) {

        LambdaQueryWrapper<User> queryWrapper = Wrappers.lambdaQuery();

        queryWrapper.eq(User::getUserName, userName);

        return this.getOne(queryWrapper, false);
    }
}
